Skip to content

benchmark: add a large JSON body scenario - #358

Merged
dimdenGD merged 1 commit into
dimdenGD:mainfrom
nigrosimone:benchmark-large-body
Jul 31, 2026
Merged

benchmark: add a large JSON body scenario#358
dimdenGD merged 1 commit into
dimdenGD:mainfrom
nigrosimone:benchmark-large-body

Conversation

@nigrosimone

Copy link
Copy Markdown
Contributor

The suite has one scenario that goes through a body parser, middlewares/body-urlencoded, and it posts 57 bytes. uWS hands a body that small to JS in a single chunk, so the parser never has to put anything together and the scenario cannot show the cost of collecting a body.

This adds middlewares/body-json-512kb, which posts 512kb of JSON through express.json(). That is above the ~512kb chunk size uWS delivers bodies in, so the body arrives in several pieces and the accumulate path is actually exercised.

The scenario validates on both frameworks (same status, same body hash). I could not run wrk locally since I am on Windows, so the numbers will come from this job.

I am also opening this separately from #357 on purpose: that PR changes how bodies are collected, and having this scenario measured on main first gives a baseline to compare it against.

The only scenario that exercises the body parsers, body-urlencoded,
posts 57 bytes. uWS hands a body that small over in a single chunk, so
the suite never measures the work of collecting a body that arrives in
pieces, and changes to that path cannot show up in the results.

Post 512kb of JSON instead, which is above the ~512kb chunk size uWS
delivers bodies in, so the parser has to put several chunks together.
@dimdenGD
dimdenGD merged commit e2a27e0 into dimdenGD:main Jul 31, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants